Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add default port for protocol #3

Merged
merged 4 commits into from
Jan 29, 2019
Merged

fix: add default port for protocol #3

merged 4 commits into from
Jan 29, 2019

Conversation

olizilla
Copy link
Contributor

multiaddrs are more explicit than urls. Default ports should always be included.

License: MIT
Signed-off-by: Oli Evans oli@tableflip.io

multiaddrs are more explicit than urls. Default ports should
always be included.

License: MIT
Signed-off-by: Oli Evans <oli@tableflip.io>
@olizilla olizilla changed the title fix: add default for protocol fix: add default port for protocol Jan 25, 2019
@olizilla olizilla requested a review from lidel January 25, 2019 17:05
olizilla added a commit to ipfs-inactive/ipfs-redux-bundle that referenced this pull request Jan 25, 2019
Depends on
- multiformats/js-uri-to-multiaddr#3
- ipfs-inactive/js-ipfs-http-client#935

Fixes ipfs/ipfs-webui#925

License: MIT
Signed-off-by: Oli Evans <oli@tableflip.io>
Copy link
Member

@lidel lidel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some small suggestions&questions below.

README.md Outdated Show resolved Hide resolved
index.js Outdated Show resolved Hide resolved
index.js Outdated Show resolved Hide resolved
index.js Outdated Show resolved Hide resolved
index.js Outdated
* https://foobar.com => /dns4/foobar.com/tcp/443/tls/http
* https://foobar.com:5001 => /dns4/foobar.com/tcp/5001/tls/http
* https://127.0.0.1:8080 => /ip4/127.0.0.1/tcp/8080/tls/http
* http://[::0]:8080 => /ip6/::0/tcp/8080/http
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why tho 🤔 For ip4 (1 line above) we default to localhost, shouldn't we do the same here? (::1)

I know this is a nit, but there is a huge difference if a beginner just copies&pastes 0.0.0.0:5001 vs 127.0.0.1:5001 without thinking, so I always try to avoid "listen on all interfaces" in examples :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@@ -3,8 +3,8 @@ const toMultiaddr = require('./')

test('should convert URIs to multiaddrs', (t) => {
const data = [
['/ip4/127.0.0.1/http', 'http://127.0.0.1'],
['/ip6/fc00::/http', 'http://[fc00::]'],
['/ip4/127.0.0.1/tcp/80/http', 'http://127.0.0.1'],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps we should keep tests for both versions?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean ip4 and ip6? Both tests have been kept, I just updated to include the port. Pesky diff.

test.js Outdated Show resolved Hide resolved
Co-Authored-By: olizilla <oli@tableflip.io>
index.js Outdated Show resolved Hide resolved
@olizilla olizilla merged commit 7be0e3f into master Jan 29, 2019
@olizilla olizilla deleted the always-add-port branch January 29, 2019 15:26
olizilla added a commit to ipfs-inactive/ipfs-redux-bundle that referenced this pull request Feb 18, 2019
You have to explicitly pass the protocol to the ipfs-http-client constructor

Depends on
- multiformats/js-uri-to-multiaddr#3
- ipfs-inactive/js-ipfs-http-client#935

Fixes ipfs/ipfs-webui#925


License: MIT
Signed-off-by: Oli Evans <oli@tableflip.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants